home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Mac Format 1995 June
/
MacFormat 25.iso
/
Shareware City
/
Developers
/
ICProgKit1.0
/
Source
/
ICGluePPC
/
ICPPCGlue.c
< prev
Wrap
C/C++ Source or Header
|
1994-11-29
|
7KB
|
326 lines
#include <Types.h>
#include <MixedMode.h>
#include <GestaltEqu.h>
#include <Components.h>
#include "ICTypes.h"
#include "ICCAPI.h"
#pragma options align=mac68k
enum {
uppCallComponentProcInfo = kPascalStackBased
| RESULT_SIZE(kFourByteCode)
| STACK_ROUTINE_PARAMETER(1, kFourByteCode)
};
pascal ICError ICStart(ICInstance *inst, OSType creator)
{
ICError junk;
ICError err;
long response;
struct {
char flags;
char size;
short what;
//
OSType creator;
//
ICInstance inst;
} start_component_params;
*inst = nil;
if (Gestalt(gestaltComponentMgr, &response) == noErr) {
*inst = (ICInstance) OpenDefaultComponent(internetConfigurationComponentType, internetConfigurationComponentSubType);
};
if (*inst == nil) {
err = badComponentInstance;
} else {
start_component_params.flags = 0;
start_component_params.size = 4;
start_component_params.what = 0;
start_component_params.creator = creator;
start_component_params.inst = *inst;
err = CallUniversalProc(CallComponentUPP, uppCallComponentProcInfo, &start_component_params);
if (err != noErr) {
junk = CloseComponent((ComponentInstance) *inst);
*inst = nil;
};
};
return(err);
}
pascal ICError ICStop(ICInstance inst)
{
ICError err;
ICError err2;
struct {
char flags;
char size;
short what;
//
//
ICInstance inst;
} stop_component_params;
stop_component_params.flags = 0;
stop_component_params.size = 0;
stop_component_params.what = 1;
stop_component_params.inst = inst;
err = CallUniversalProc(CallComponentUPP, uppCallComponentProcInfo, &stop_component_params);
err2 = CloseComponent((ComponentInstance) inst);
if (err == noErr) {
err = err2;
};
return(err);
}
pascal ICError ICFindConfigFile(ICInstance inst, short count, ICDirSpecArrayPtr folders)
{
struct {
char flags;
char size;
short what;
//
ICDirSpecArrayPtr folders;
short count;
//
ICInstance inst;
} find_config_file_params;
find_config_file_params.flags = 0;
find_config_file_params.size = 6;
find_config_file_params.what = 2;
find_config_file_params.folders = folders;
find_config_file_params.count = count;
find_config_file_params.inst = inst;
return(CallUniversalProc(CallComponentUPP, uppCallComponentProcInfo, &find_config_file_params));
}
pascal ICError ICSpecifyConfigFile(ICInstance inst, FSSpec *config)
{
struct {
char flags;
char size;
short what;
//
FSSpec *config;
//
ICInstance inst;
} specify_config_file_params;
specify_config_file_params.flags = 0;
specify_config_file_params.size = 4;
specify_config_file_params.what = 3;
specify_config_file_params.config = config;
specify_config_file_params.inst = inst;
return(CallUniversalProc(CallComponentUPP, uppCallComponentProcInfo, &specify_config_file_params));
}
pascal ICError ICGetSeed(ICInstance inst, long *seed)
{
struct {
char flags;
char size;
short what;
//
long *seed;
//
ICInstance inst;
} get_seed_params;
get_seed_params.flags = 0;
get_seed_params.size = 4;
get_seed_params.what = 4;
get_seed_params.seed = seed;
get_seed_params.inst = inst;
return(CallUniversalProc(CallComponentUPP, uppCallComponentProcInfo, &get_seed_params));
}
pascal ICError ICBegin(ICInstance inst, ICPerm perm)
{
struct {
char flags;
char size;
short what;
//
ICPerm perm;
//
ICInstance inst;
} begin_params;
begin_params.flags = 0;
begin_params.size = 2;
begin_params.what = 5;
begin_params.perm = perm;
begin_params.inst = inst;
return(CallUniversalProc(CallComponentUPP, uppCallComponentProcInfo, &begin_params));
}
pascal ICError ICGetPref(ICInstance inst, ConstStr255Param key, ICAttr *attr, Ptr buf, long *size)
{
struct {
char flags;
char size;
short what;
//
long *psize;
Ptr buf;
ICAttr *attr;
Str255 *key;
//
ICInstance inst;
} get_pref_params;
get_pref_params.flags = 0;
get_pref_params.size = 16;
get_pref_params.what = 6;
//
get_pref_params.psize = size;
get_pref_params.buf = buf;
get_pref_params.attr = attr;
get_pref_params.key = (Str255 *) key;
//
get_pref_params.inst = inst;
return(CallUniversalProc(CallComponentUPP, uppCallComponentProcInfo, &get_pref_params));
}
pascal ICError ICSetPref(ICInstance inst, ConstStr255Param key, ICAttr attr, Ptr buf, long size)
{
struct {
char flags;
char size;
short what;
//
long psize;
Ptr buf;
ICAttr attr;
Str255 *key;
//
ICInstance inst;
} set_pref_params;
set_pref_params.flags = 0;
set_pref_params.size = 16;
set_pref_params.what = 7;
//
set_pref_params.psize = size;
set_pref_params.buf = buf;
set_pref_params.attr = attr;
set_pref_params.key = (Str255 *) key;
//
set_pref_params.inst = inst;
return(CallUniversalProc(CallComponentUPP, uppCallComponentProcInfo, &set_pref_params));
}
pascal ICError ICCountPref(ICInstance inst, long *count)
{
struct {
char flags;
char size;
short what;
//
long *count;
//
ICInstance inst;
} count_pref_params;
count_pref_params.flags = 0;
count_pref_params.size = 4;
count_pref_params.what = 8;
count_pref_params.count = count;
count_pref_params.inst = inst;
return(CallUniversalProc(CallComponentUPP, uppCallComponentProcInfo, &count_pref_params));
}
pascal ICError ICGetIndPref(ICInstance inst, long n, Str255 key)
{
struct {
char flags;
char size;
short what;
//
StringPtr key;
long n;
//
ICInstance inst;
} get_ind_pref_params;
get_ind_pref_params.flags = 0;
get_ind_pref_params.size = 8;
get_ind_pref_params.what = 9;
//
get_ind_pref_params.key = (StringPtr) key;
get_ind_pref_params.n = n;
//
get_ind_pref_params.inst = inst;
return(CallUniversalProc(CallComponentUPP, uppCallComponentProcInfo, &get_ind_pref_params));
}
pascal ICError ICDeletePref(ICInstance inst, ConstStr255Param key)
{
struct {
char flags;
char size;
short what;
//
Str255 *key;
//
ICInstance inst;
} delete_pref_params;
delete_pref_params.flags = 0;
delete_pref_params.size = 4;
delete_pref_params.what = 12;
//
delete_pref_params.key = (Str255 *) key;
//
delete_pref_params.inst = inst;
return(CallUniversalProc(CallComponentUPP, uppCallComponentProcInfo, &delete_pref_params));
}
pascal ICError ICEnd(ICInstance inst)
{
struct {
char flags;
char size;
short what;
//
//
ICInstance inst;
} end_params;
end_params.flags = 0;
end_params.size = 0;
end_params.what = 10;
//
end_params.inst = inst;
return(CallUniversalProc(CallComponentUPP, uppCallComponentProcInfo, &end_params));
}
pascal ICError ICDefaultFileName(ICInstance inst, Str63 name)
{
struct {
char flags;
char size;
short what;
//
StringPtr name;
//
ICInstance inst;
} default_file_name_params;
default_file_name_params.flags = 0;
default_file_name_params.size = 4;
default_file_name_params.what = 11;
default_file_name_params.name = (StringPtr) name;
default_file_name_params.inst = inst;
return(CallUniversalProc(CallComponentUPP, uppCallComponentProcInfo, &default_file_name_params));
}
pascal ICError ICGetComponentInstance(ICInstance inst, Ptr *component_inst)
{
*component_inst = inst;
}